//
// Created by ubuntu on 2024/1/3.
//
#include <vector>
#include <string>
#include <ros/ros.h>
#include <geometry_msgs/Point.h>
#include "subscriber_scan.h"

int main(int argc, char **argv)
{
    if (ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug))
    {
        ros::console::notifyLoggerLevelsChanged();
    }
    ROS_DEBUG("Starting line_extraction_node.");
    ros::init(argc, argv, "line_extraction_node");
    ros::NodeHandle nh;
    ros::NodeHandle nh_local("~");
    double frequency;
    std::string frame_id_;
    std::string scan_topic_;
    nh_local.param<double>("frequency", frequency, 25);
    nh_local.param<std::string>("scan_topic", scan_topic_, "/scan");
    nh_local.param<std::string>("frame_id", frame_id_, "laser");
    std::shared_ptr<line_extraction::SubcriberScan> cloud_sub_ptr =
            std::make_shared<line_extraction::SubcriberScan>(nh, nh_local, scan_topic_, 1, frame_id_);
    ROS_DEBUG("Frequency set to %0.1f Hz", frequency);
    ros::Rate rate(frequency);
    while (ros::ok())
    {
        cloud_sub_ptr->startRun();
        ros::spinOnce();
        rate.sleep();
    }
    return 0;
}

